<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
    <%@page isELIgnored="false" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>审批</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link id="bootstrap-style" href="<%=basePath%>css/bootstrap.min.css" rel="stylesheet">
	<link href="<%=basePath%>css/bootstrap-responsive.min.css" rel="stylesheet">
	<link id="base-style" href="<%=basePath%>css/style.css" rel="stylesheet">
	<link id="base-style-responsive" href="<%=basePath%>css/style-responsive.css" rel="stylesheet">
	<link href="<%=basePath%>css/index.css" rel="stylesheet">
	<link rel="shortcut icon" href="<%=basePath%>img/favicon.ico">
	<link href="<%=basePath%>css/page.css" rel="stylesheet">
	<link href="<%=basePath%>css/but.css" rel="stylesheet">
	<script src="<%=basePath%>js/jquery-1.9.1.min.js"></script>
	<script src="<%=basePath%>js/jquery-migrate-1.0.0.min.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/layer/layer.js"></script>
</head>
 <script type="text/javascript">
 function gotoPage(pageNum){
	    var tusname=jQuery("#tusname").val();
	    tusname= encodeURI(encodeURI(tusname));
	    jQuery("#name").val(tusname);
	 	var totalPage=jQuery("#totalPage").val();
		regexpdat=/^\d+$/;
		if(!regexpdat.test(pageNum)){
			alert("查询的页面必须为数字");
			return ;
		}
		if(1 > pageNum || pageNum > totalPage){
			alert("请求页面不在范围之内，请重新输入");
			return;
		}
		jQuery("#currentPage").val(pageNum);
		document.forms["frm"].submit();
	}
 
 function submitForm(){
	 var tusname=jQuery("#tusname").val();
	 tusname= encodeURI(encodeURI(tusname));
	 jQuery("#name").val(tusname);
	 document.forms["frm"].submit();
 }
 function xiugai(id) {
	 var url=$("#basePath").attr("value");
	 url +="user/updateUsermain?id="+id+"&type=update";
	 parent.$("#mainFrame").attr("src",url);
 }
 function selectlook(id) {
	 var url=$("#basePath").attr("value");
	 url +="user/updateUsermain?id="+id+"&type=select";
	 parent.$("#mainFrame").attr("src",url);
 }
 function deleteUser(id){
	 if(confirm("确定删除该员工信息吗?")){
			jQuery.ajax({
				url:'<%=basePath%>user/deleteUser?id='+id,
				type:"post",
				dataType:"json",
				success:function(json){
				}
			});
			window.location.reload();
		}
 }
 
 function lookapprove(id,type) {
     layer.open({
		title: '审批详情',
       type: 2,
       area: ['800px', '660px'],
       fixed: false, //不固定
       maxmin: true,
       content: '<%=basePath%>approve/lookapprovemain?id='+id+'&type='+type
     });
 }
 function approve(id,type) {
     layer.open({
		title: '审批详情',
       type: 2,
       area: ['800px', '660px'],
       fixed: false, //不固定
       maxmin: true,
       content: '<%=basePath%>approve/approvemain?id='+id+'&type='+type
     });
 }
 function xinzeng(type){
	 var url=$("#basePath").attr("value");
	 url +="user/addUsermain";
	 parent.$("#mainFrame").attr("src",url);
	
 }
 </script>
<body>
<div class="container-fluid-full">
	<div class="row-fluid">
		<div id="basePath" value="<%=basePath%>" style="display:none;"></div>
		<form name="frm" id="frm" method="get" action="<%=basePath%>approve/index">
				<input type="hidden" id="totalPage" name="totalPage" value="${totalPage}"> 
				<input type="hidden" id="currentPage" name="currentPage" value="${currentPage}"> 
				<input type="hidden" id="name" name="name" value="${name}">
				<div id="content" class="span10" >
					<div class="row-fluid content-search">
						<div>
							<span>申请者</span>
							<input type="text" id="tusname" name="tusname" value="${name }">
						</div>
						<div>
							<span>文档状态</span>
							<select name="tstatus" class="buildselect">
								<option value="">请选择</option>
								<option value="1">审批中</option>
								<option value="2">已结束</option>
							</select>
						</div>
						<div>
							<span>申请时间</span>
							<input type="date" id="fromDate" name="fromDate" style="width:30%;">
							<span>到</span>
							<input type="date" id="endDate" name="endDate" style="width:30%;">
						</div>
						<div><button class="but" type="button" id="select" onclick="submitForm();">查询</button></div>
						<div><button class="but" type="button" id="select" onclick="">打印</button></div>
	
					</div>
					<div class="row-fluid content-table">
						<table class="table table-striped table-bordered bootstrap-datatable">
						  <thead>
							  <tr>
							  	  <th>选择</th>
							  	  <th>编号</th>
								  <th>标题</th>
								  <th>当前处理人</th>
								  <th>当前状态</th>
								  <th>申请者</th>
								  <th>申请时间</th>
								  <th>业务审批名称</th>
								  <th>操作</th>
							  </tr>
						  </thead>   
						  <tbody>
						  	<c:forEach items="${list }" var="a">
								<tr>
									<td><input type="checkbox"></td>
									<td>${a.id }</td>
									<td>${a.title }</td>
									<td>${a.authorname }</td>
									<td>
										<c:if test="${a.status == 1}">审批中</c:if>	
										<c:if test="${a.status == 2}">已结束</c:if>
									</td>
									<td>${a.user.name }</td>
									<td>
										<jsp:useBean id="Timestamp" class="java.util.Date"/> 
										<c:set target="${Timestamp}" property="time" value="${a.createtime}"/> 
										<fmt:formatDate pattern="yyyy-MM-dd" value="${Timestamp}" type="both"/> 
									</td>
									<td>${a.name }</td>
									<td>
										<c:if test="${a.status == 1}">
											<a href="#" onclick="lookapprove(${a.id},${a.type});">查看</a>
											<a href="#" onclick="approve(${a.id},${a.type});">审批</a>
										</c:if>
										<c:if test="${a.status == 2}">
											<a href="#" onclick="lookapprove(${a.id},${a.type});">查看</a>
										</c:if>
									</td>
								</tr>
						  	</c:forEach>
						  </tbody>
					  </table>            
					</div>	
					<div id="app">
				    <div>
				    
				      <div class="page"  v-show="show">
				      	<div class="span">
						</div>
				        <div class="pagelist">
				        
				          <span class="jump" :class="{disabled:pstart}" onClick="gotoPage(1);">首页</span>
				          <span class="jump" :class="{disabled:pstart}" onClick="gotoPage(${currentPage}-1);return false;">上一页</span>
				          <span v-show="current_page>5" class="jump" onClick="gotoPage(1);">1</span>
				          <span class="ellipsis"  v-show="efont">...</span>
				          <span class="jump" v-for="num in indexs" :class="{bgprimary:current_page==num}" onClick="gotoPage(jQuery(this).text());">{{num}}</span>
				          <span class="ellipsis"  v-show="ebehind">...</span>
				
				          <span :class="{disabled:pend}" class="jump" onClick="gotoPage(${currentPage}+1);return false;">下一页</span>
				          <span v-show="current_page<pages-4" class="jump" onClick="gotoPage(${totalPage})">{{pages}}</span>
				
				          <span class="jumppoint">跳转到：</span>
				          <span class="jumpinp"><input type="text" v-model="changePage" name="pageNum" id="pageNum" value=""/></span>
				          <span class="jump gobtn" onClick="gotoPage(jQuery('#pageNum').val())">GO</span>
				        </div>
				      </div>
				    </div>
				  </div>
				</div>
		</form>
	</div>
</div>
			<script src="<%=basePath%>js/vue.js"></script>
			<script src="<%=basePath%>js/vueClick.js"></script>
</body>
</html>
